package com.tgu.home_action.pojo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.sql.Timestamp;

@Data
@ApiModel(description = "第三方应用")
public class Client {
    public interface insert {
    }

    public interface update {
    }

    public interface login {
    }

    @NotNull(message = "id不能为空", groups = {update.class})
    @ApiModelProperty("ID")
    private Integer id;
    @NotNull(message = "appId不能为空", groups = {insert.class, login.class})
    @ApiModelProperty("appId")
    private String appId;
    @NotNull(message = "accessKey不能为空", groups = {insert.class, long.class})
    @JsonBackReference("appKey")
    @ApiModelProperty("appKey")
    private String accessKey;
    @NotNull(message = "name不能为空", groups = {insert.class})
    @ApiModelProperty("应用名")
    private String name;
    @ApiModelProperty("备注")
    private String comment;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("注册时间")
    private Timestamp registerTime;
    @JsonBackReference("当前页")
    @ApiModelProperty("当前页")
    private Integer pageNo;

    @JsonBackReference("每页条数")
    @ApiModelProperty("每页条数")
    private Integer pageSize;

    /**
     * 分页查询前面的数据
     */
    @JsonIgnore
    private Integer startSize;

    public Client() {
    }

    public Client(Integer id) {
        this.id = id;
    }
}
